********************************************************************************
* File description: Replication materials for "Who is a Christian nationalist?"
* Date: 			04/11/2022
* Edited by: 		NTD
* Documentation: 	Latent Class analysis is preformed in R; data is then ported 
*                   to dataset here. The particulars of that analysis may be 
*					found in the file "polca-xn-final-run.R". The fit estimates 
*					derived for Table 2 are generated in that syntax file. Here,
*					the four-class typology is termed "pred4" for all analysis. 
*                   Prior to LCA/recoding  in this file, observatiosn w missing 
* 					data (.) in raw	Baylor data for MP12A-MP12F was dropped. 
*					This was done because LCA is only possible for obs. with values. 
* Datafile:			For main paper analysis, use: "xn-final.dta" which is raw datafile, 
*					with LCA categories merged 
********************************************************************************

* Individual instruments for the six-item Christian nationalism battery 
* Variable names ending with _alt stem have had missing responses purged

********************************************************************************
* (1) Please rate the extent to which you agree or disagree with the following statements: The federal government should declare the United States as a Christian nation. (MP12A)
********************************************************************************

* Original coding in Whitehead and Perry (2020)
gen xiannation = MP12A 
recode xiannation 3=4 4=5 8=3

* Stripping out undecided 
gen xiannation_alt = xiannation
recode xiannation_alt 3=. 4=3 5=4 

********************************************************************************
* (2) Please rate the extent to which you agree or disagree with the following statements: The federal government should advocate Christian values. (MP12B)
********************************************************************************

* Original coding in Whitehead and Perry (2020)
gen xianvalues = MP12B
recode xianvalues 3=4 4=5 8=3

* Stripping out undecided 
gen xianvalues_alt = xianvalues
recode xianvalues_alt 3=. 4=3 5=4 

********************************************************************************
* (3) Please rate the extent to which you agree or disagree with the following statements: The federal government should enforce strict separation of church and state. (MP12C)
********************************************************************************

* Original coding in Whitehead and Perry (2020)
gen churchstate = MP12C
recode churchstate 1=5 2=4 8=3 3=2 4=1

* Stripping out undecided 
gen churchstate_alt = churchstate
recode churchstate_alt 3=. 4=3 5=4 

********************************************************************************
* (4) Please rate the extent to which you agree or disagree with the following statements: The federal government should allow the display of religious symbols in public spaces. (MP12D)
********************************************************************************

* Original coding in Whitehead and Perry (2020)
gen pubreligion = MP12D
recode pubreligion 3=4 4=5 8=3

* Stripping out undecided
gen pubreligion_alt = pubreligion
recode pubreligion_alt 3=. 4=3 5=4 

********************************************************************************
* (5) Please rate the extent to which you agree or disagree with the following statements: The success of the United States is part of God's plan. (MP12E)
********************************************************************************

* Original coding in Whitehead and Perry (2020)
gen godsplan = MP12E
recode godsplan 3=4 4=5 8=3

* Stripping out undecided 
gen godsplan_alt = godsplan
recode godsplan_alt 3=. 4=3 5=4 

********************************************************************************
* (6) Please rate the extent to which you agree or disagree with the following statements: The federal government should allow prayer in public schools. (MP12F)
********************************************************************************

* Original coding in Whitehead and Perry (2020)
gen prayer = MP12F
recode prayer 3=4 4=5 8=3

* Stripping out undecided
gen prayer_alt = prayer
recode prayer_alt 3=. 4=3 5=4 

********************************************************************************
* Creating additive index of Christian nationalism index 
********************************************************************************

* Original coding scheme 
gen xn = (xiannation + xianvalues + pubreligion + godsplan + prayer + churchstate)-6 // ranges from 0 to 24

* XN without undecided responses
gen xn_alt = (xiannation_alt + xianvalues_alt + churchstate_alt + pubreligion_alt +godsplan_alt + prayer_alt)-6 // ranges from 0 to 18

gen xn01 = xn/24

* Xn dummies
tab xn, gen(xn)

********************************************************************************
* Covariates of interest
********************************************************************************

* Partisanship
gen pid = Q32 // reverse coded so that Rep is low, so next command shifts Dem to low
recode pid 1=7 2=6 3=5 4=4 5=3 6=2 7=1

* 3-category partisanship
gen pid3 = pid
recode pid 1/3=1 4=2 5/7=3 
label define three 1 "Democrat" 2 "Independent" 3 "Republican"
label value pid3 three

* ideo = lib-con ideology
gen ideo = Q31
omscore ideo
replace ideo = rr_ideo

* Republican dummy term
gen rep = pid // republican vs. not
recode rep 1/4=0 5/7=1

* Race
gen white = (I_RACE==1)
gen black = (I_RACE==2)

* Gender
gen female = (Q77==2)

* Denomination data 
gen evangelical = (I_RELIGION==1)
gen mainline = (I_RELIGION==2)
gen catholic = (I_RELIGION==4)

* Religiosity: prayer, attend already coded 
gen bible = Q17
recode bible 1=4 2=3 3=2 4=1 5/99=.

* Religiosity index 
factor bible attend prayer
predict religiosity
sum religiosity 
gen religiosity01 = (religiosity-r(min))/(r(max)-r(min))
sum religiosity01

* Trump vote = comparison between a Clinton and Trump vote, where else = missing
gen trump = MP7
recode trump 2=1 1=0 3/99=.

* Christian / non
gen xiangroup = .
replace xiangroup = 1 if evangelical == 1
replace xiangroup = 1 if mainline == 1
replace xiangroup = 1 if catholic == 1
replace xiangroup = 0 if xiangroup== .

********************************************************************************
* Policy preferences // values are recoded so that conservative response = high values
********************************************************************************
* Transgender bathrooms: Please rate the extent to which you agree or disagree with the following statements: Transgender people should be allowed to use the public restroom of their choice. (MP4A) 

gen trans = MP4A
recode trans 1=4 2=3 3=2 4=1 5/99=. 

* Gay marriage policy: Please rate the extent to which you agree or disagree with the following statements: Gays and lesbians should be allowed to legally marry. (Q61B)

gen gaymarr = Q61B 
recode gaymarr 1=4 2=3 3=2 4=1 5/99=.

* Sexism: Please rate the extent to which you agree or disagree with the following statements: Men are better suited emotionally for politics than women. (MP4D)

gen sexism = MP4D
recode sexism 5/99=.

* Refugees: Please rate the extent to which you agree or disagree with the following statements: Refugees from the Middle East pose a terrorist threat to the United States. (MP4J)

gen terrorists = MP4J
recode terrorists 5/99=. 

********************************************************************************
* Analysis in the main paper
********************************************************************************

********************************************************************************
* Table 1: Principal factors analysis of the Christian nationalism index, with and without rotation
********************************************************************************
alpha xiannation xianvalues churchstate pubreligion godsplan prayer
factor xiannation xianvalues churchstate pubreligion godsplan prayer, blanks(.5)
rotate, oblique promax(2) blanks(.5)
predict one1 two2

********************************************************************************
* Figure 1: Comparing views about whether America is a Christian nation and the appropriateness of public displays of religion
********************************************************************************

graph twoway (scatter one1 two2, jitter(2.5) mcolor(gs10) mfcolor(gs10) msize(med)) (lfit one1 two2,  lcolor(gs2)), legend(off) xtitle("Factor 2: Public displays of religion" "Higher values = more support") ytitle("Factor 1: Christian" "nation / values" "Higher values =" "more agreement", axis(1) orientation(horizontal)) aspect(1) xlab(-1.5 -1 -.5 0 .5 1 1.5,notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylab(-1.5 -1 -.5 0 .5 1 1.5,notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ysc(lcolor(none)) xsc(lcolor(none))

********************************************************************************
* Figure 2: Comparing an additive and latent class analysis typology of Christian nationalism 
********************************************************************************

catplot xn, by(pred4, col(4) note(" "))  ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ytitle("Frequency") ysc(lcolor(none)) 

********************************************************************************
* Table 2. Misclassification across the Christian nationalism typology
********************************************************************************
* LCA solution generated from R, see: "polca-xn-final-run.R" for details

* Generating "original" Christian nationalism groupings from Whitehead and Perry (2020)

gen xn_group = 1 if xn <6 // Rejectors 
replace xn_group = 2 if xn <12 & xn_group==. // Resisters
replace xn_group = 3 if xn <18 & xn_group==. // Accommodators
replace xn_group = 4 if xn <25 & xn_group==. // Ambassadors 

label define xiannat 1 "Rejectors" 2 "Resisters" 3 "Accommodators" 4 "Ambassadors"
label value xn_group xiannat 

* Generating differences (misclassifications) in original Christian nationalism groupings according to LCA

gen correct = .
replace correct = 1 if pred4==1 & xn_group==1
replace correct = 1 if pred4==2 & xn_group==2
replace correct = 1 if pred4==3 & xn_group==3
replace correct = 1 if pred4==4 & xn_group==4
replace correct = 0 if pred4!=xn_group & xn_group!=. & pred4!=.

gen misclassify = correct
recode misclassify 1=0 0=1

tab pred4 misclassify, column


********************************************************************************
* Figure 3: Different ways of portraying the relationship between Christian nationalism and Trump vote
********************************************************************************

* (1) generate categories for Christian nationalism index 
tab xn, gen(xn)

reg trump xn1-xn12 xn14-xn25 pid ideo age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid ideo age I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 14 15 16 17 18 19 20 21 22 23 24,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Log-odds coefficient", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) saving(fig3b.gph, replace) title("(B) Marginal effects of Christian" "nationalism against scale mid-point", size(Medium))

reg trump xn pid age I_EDUC ideo white black female evangelical mainline catholic [pweight=weight]
margins, at(xn=(0(1)24))
marginsplot, xlabel(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ciopts(lcolor(black)) ytitle("Marginal prediction of Trump vote", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) title("(A) Predicted Trump vote" "by Christian nationalism score", size(Medium)) saving(fig3a.gph, replace)

gr combine fig3a.gph fig3b.gph

********************************************************************************
* Table 3: Linear combination tests for differences among different values of Christian nationalism

* regress categories on DV, where excluded value / category is scale mid-point

logit trump xn1-xn12 xn14-xn25 pid ideo age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
lincom xn1 - xn6
lincom xn9 - xn15
lincom xn17 - xn23
********************************************************************************

********************************************************************************
* Figure 4 
********************************************************************************

*IMPORTANT! use "combined-brs.dta" for Figure 4 analysis 

* Panel A
histogram xn, freq xlabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ytitle("Frequency", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) title("(A) Distribution of Christian nationalism" "scores in combined 2007, 2017 BRS surveys", size(Medium)) saving(fig4a.gph, replace) discrete bcolor(gs14) blcolor(black)

* Panel B
logit repvote xn1 xn2 xn3 xn4 xn5 xn6 xn7 xn8 xn9 xn10 xn11 xn12 xn14 xn15 xn16 xn17 xn18 xn19 xn20 xn21 xn22 xn23 xn24 xn25 pid ideo age I_EDUC  white black female evangelical year17 [pweight=weight]
est store xn
coefplot xn, drop(pid ideo age I_EDUC white black female evangelical  _cons year17) vertical yline(0, lcolor(red)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 14 15 16 17 18 19 20 21 22 23 24,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Log-odds coefficient", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) saving(fig4b.gph, replace) title("(B) Marginal effects of Christian nationalism" "on Republicain vote against scale mid-point", size(Medium))
********************************************************************************
* Figure 5: Predicted Trump voting among partisans 
********************************************************************************

reg trump i.pid3#xn ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
margins, at(xn=(0(1)24) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle("pr(Trump vote)") title("(C) Predicted Trump vote" "by partisanship and Christian nationalism score", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(fig5.gph, replace)

* Auxillary analysis for Figure 5 with combined sample 
* IMPORTANT! use "combined-brs.dta" for analysis below 

reg repvote i.pid3#xn ideo age I_EDUC  white black female evangelical year17   [pweight=weight]
margins, at(xn=(0(1)24) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle("pr(Republican vote)") title(, size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(trumpc.gph, replace)

*logit repvote xn pid ideo age I_EDUC  white black female evangelical year17 [pweight=weight]

********************************************************************************
* Table 4
********************************************************************************

reg ideo pid xn01 age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store ideology
reg copssame pid xn01 ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store copssame
reg terrorists pid xn01 ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store terrorists
reg gaymarr pid xn01 ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store gaymarr

estout ideology copssame terrorists gaymarr, cells(b(star fmt(3)) se(par fmt(2))) stats(r2_a N,  fmt(%9.3f %9.0g) labels(R-squared)) varlabels(_cons Constant) collabels(none) label 

********************************************************************************
* Figures 6 and 7 panel generation 
********************************************************************************
* (A) ideology
********************************************************************************

* Xn marginal effects across range, against mid-point
reg ideo xn1-xn12 xn14-xn25 pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid age I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 14 15 16 17 18 19 20 21 22 23 24,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) saving(ideology_marg.gph, replace) title("(A) Ideology", size(Medium))

* by partisanship
reg ideo i.pid3#xn age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
margins, at(xn=(0(1)24) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle("Lib-con ideology") title("(A) Predicted Ideology", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(a.gph, replace)


********************************************************************************
* police
********************************************************************************

reg copssame ideo xn1-xn12 xn14-xn25 pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid ideo age I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 14 15 16 17 18 19 20 21 22 23 24,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) saving(police_marg.gph, replace) title("(B) Cops treat whites, blacks same", size(Medium))

* by partisanship 
reg copssame i.pid3#xn ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
margins, at(xn=(0(1)24) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle("Agree = high values") title("(B) Cops treat whites, blacks same", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(b.gph, replace)

********************************************************************************
* refugees are terrorists 
********************************************************************************

reg terrorists ideo xn1-xn12 xn14-xn25 pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid ideo age I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 14 15 16 17 18 19 20 21 22 23 24,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) saving(refugee_marg.gph, replace) title("(C) Refugees from MENA are a threat", size(Medium))

* by partisanship 
reg terrorists i.pid3#xn ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
margins, at(xn=(0(1)24) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle("Agree = high values") title("(C) Refugees from MENA are a threat", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(c.gph, replace)

********************************************************************************
* same-sex marriage 
********************************************************************************

* Xn marginal effects across range, against mid-point
reg gaymarr ideo xn1-xn12 xn14-xn25 pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid ideo age I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 14 15 16 17 18 19 20 21 22 23 24,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Score on Christian nationalism scale") aspect(1) saving(samesex_marg.gph, replace) title("(D) Same-sex marriage support", size(Medium))

*by partisanship
reg gaymarr ideo pid3 xn pid3Xxn age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
reg gaymarr i.pid3#xn ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
margins, at(xn=(0(1)24) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle("Oppose = high values") title("(D) Same-sex marriage opposition", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(d.gph, replace)

********************************************************************************
* Figure 6
********************************************************************************

gr combine ideology_marg.gph police_marg.gph refugee_marg.gph samesex_marg.gph

********************************************************************************
* Figure 7
********************************************************************************

* predictions combined 
grc1leg a.gph b.gph c.gph d.gph

********************************************************************************
* Figure 8
********************************************************************************
reg ideo xiancountry1 xiancountry2 xiancountry3 xiancountry5 xiancountry6 xiancountry7 pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid age ideo I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 2 3 4 "5" 5 "6" 6 "7",  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Christian nationalism") aspect(1) saving(fig8a.gph, replace) title("(A) Ideology" " " , size(Medium))

reg copssame ideo xiancountry1 xiancountry2 xiancountry3 xiancountry5 xiancountry6 xiancountry7  pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid age ideo I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 2 3 4 "5" 5 "6" 6 "7",  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Christian nationalism") aspect(1) saving(fig8b.gph, replace) title("(B) Cops treat White," "Blacks same", size(Medium))

reg terrorists ideo xiancountry1 xiancountry2 xiancountry3 xiancountry5 xiancountry6 xiancountry7  pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid age ideo I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 2 3 4 "5" 5 "6" 6 "7",  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Christian nationalism") aspect(1) saving(fig8c.gph, replace) title("(C) Refugees from" "MENA threat", size(Medium))

reg gaymarr ideo xiancountry1 xiancountry2 xiancountry3 xiancountry5 xiancountry6 xiancountry7  pid age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store xn
coefplot xn, drop(pid age ideo I_EDUC white black female evangelical mainline catholic _cons) vertical yline(0, lcolor(red)) xlabel(1 2 3 4 "5" 5 "6" 6 "7",  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,  notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) mcolor(black) mfcolor(black) ciopts(lcolor(black)) ytitle("Marginal effect", angle(90)) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) xtitle("Christian nationalism") aspect(1) saving(fig8d.gph, replace) title("(D) Same-sex" "marriage support", size(Medium))

gr combine fig8a.gph fig8b.gph fig8c.gph fig8d.gph

********************************************************************************
* table 5
********************************************************************************

reg ideo pid xiancountry01 pubdisplay01 age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store ideology
reg copssame pid xiancountry01 pubdisplay01 ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store copssame
reg terrorists pid xiancountry01 pubdisplay01 ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store terrorists
reg gaymarr pid xiancountry01 pubdisplay01 ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store gaymarr

estout ideology copssame terrorists gaymarr, cells(b(star fmt(3)) se(par fmt(2))) stats(r2_a N,  fmt(%9.3f %9.0g) labels(R-squared)) varlabels(_cons Constant) collabels(none) label 

********************************************************************************
* Appendix 
********************************************************************************

* Table A1. Differences in correlations across coding schemes

cor xiannation_alt xianvalues_alt churchstate_alt pubreligion_alt godsplan_alt prayer_alt
cor xiannation xianvalues churchstate pubreligion godsplan prayer

********************************************************************************

* Table A2. Demographic differences among the additive and LCA typologies

tab pred4 evangelical, column
tab xn_group evangelical, column 

tab pred4 mainline, column 
tab xn_group mainline, column 

tab pred4 catholic, column
tab xn_group catholic, column

tab pred4 jewish, column
tab xn_group jewish, column

mean religiosity01, over(pred4)
mean religiosity01, over(xn_group)

mean pid, over(pred4)
mean pid, over(xn_group)

********************************************************************************

* Figure A1. Summary stats for the typology – avg item scores across groups 

mean xiannation, over(pred4)
est store t1a
mean xiannation, over(xn_group)
est store t1b

mean xianvalues, over(pred4) 
est store t2a
mean xianvalues, over(xn_group) 
est store t2b

mean pubreligion, over(pred4) 
est store t3a
mean pubreligion, over(xn_group) 
est store t3b

mean godsplan, over(pred4) 
est store t4a
mean godsplan, over(xn_group) 
est store t4b

mean prayer, over(pred4) 
est store t5a
mean prayer, over(xn_group) 
est store t5b

mean churchstate, over(pred4)
est store t6a
mean churchstate, over(xn_group)
est store t6b

coefplot (t1a, label("LCA")) (t1b, label("Additive")), bylabel("Christian nation") || t2a t2b, bylabel("Christian values") || t3a t3b, bylabel("Public religion") || t4a t4b, bylabel("God's plan")  ||t5a t5b, bylabel("Prayer in schools")  || t6a t6b, bylabel("Separate church/state") ||, xlabel(,notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(,notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) ysc(lcolor(none)) xsc(lcolor(none))

********************************************************************************
* alt modeling of figure 8, breaking apart for PID
********************************************************************************

reg ideo i.pid3#xiancountry age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
margins, at(xiancountry=(2(1)8) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle(" ") title("(A) Ideology", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(9a.gph, replace)

reg copssame ideo i.pid3#xiancountry age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
margins, at(xiancountry=(2(1)8) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle(" ") title("(B) Cops treat same", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(9b.gph, replace)

reg terrorists ideo i.pid3#xiancountry age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
margins, at(xiancountry=(2(1)8) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle(" ") title("(C) Refugees threat", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(9c.gph, replace)

reg gaymarr ideo i.pid3#xiancountry age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
margins, at(xiancountry=(2(1)8) pid=(1,2,3))
marginsplot, plot1opts(lcolor(blue) mcolor(blue) msymbol(Oh)) ci1opt(color(blue%10) mfcolor(blue%10)) recast(connected) recastci(rarea) plot2opts(lcolor(black) mcolor(black) msymbol(X) msize(medium)) ci2opt(color(black%10) mfcolor(black%10)) plot3opts(lcolor(red) mcolor(red) msymbol(dh) msize(medium)) ci3opt(color(red%10) mfcolor(red%10)) legend(order(1 "Democrats" 2 "Independents" 3 "Republicans")) xtitle("Christian nationalism") ytitle(" ") title("(D) Same-sex marriage", size(Medium)) xlabel(,  notick labcolor(black) labsize(small)grid glstyle(solid) glcolor(gs14) gmax gmin) ylabel(, notick labcolor(black) labsize(small) grid glstyle(solid) glcolor(gs14) gmax gmin) plotregion(lcolor(none)) ysc(lcolor(none)) xsc(lcolor(none)) saving(9d.gph, replace)

grc1leg 9a.gph 9b.gph 9c.gph 9d.gph

********************************************************************************
* interaction model tables
********************************************************************************

reg trump pid3 xn pid3Xxn ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store trump 
reg ideo pid3 xn pid3Xxn age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store ideology
reg copssame pid3 xn pid3Xxn ideo age I_EDUC  white black female evangelical mainline catholic  [pweight=weight]
est store copssame
reg terrorists pid3 xn pid3Xxn ideo age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store terrorists
reg gaymarr pid3 xn pid3Xxn ideo age I_EDUC  white black female evangelical mainline catholic [pweight=weight]
est store gaymarr

estout trump ideology copssame terrorists gaymarr, cells(b(star fmt(3)) se(par fmt(2))) stats(r2_a N,  fmt(%9.3f %9.0g) labels(R-squared)) varlabels(_cons Constant) collabels(none) label 

